#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>

int main()
{
    int fd = open("./1.txt",O_RDWR | O_CREAT,0664);
    if(fd < 0)
    {
        perror("open");
        return 0;
    }

    printf("fd = %d\n",fd);

    write(fd,"i am student",13);

    lseek(fd,0,SEEK_SET);

    char buf[1024] = {0};
    read(fd,buf,sizeof(buf)-1);

    printf("buf:%s\n",buf);
    return 0;
}
